package com.example.onlinemusic.controller;

import com.example.onlinemusic.model.User;
import com.example.onlinemusic.tools.ResponseBodyMessage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hhhh")
public class TestController {
    @RequestMapping("/test")
    public ResponseBodyMessage<User> test(@RequestParam String username,
                                          @RequestParam String password){
        User user = new User();
        if("bit".equals(username) && "123456".equals(password)){
            //验证成功，登录成功
            user.setUsername(username);
            user.setPassword(password);
            return new ResponseBodyMessage<>(0,"登录成功",user);
        }
        return new ResponseBodyMessage<>(-1,"用户名或密码错误，登录失败",user);
    }

}
